package com.lagou.edu.mvcframework.pojo;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class HandlerExecutionChain {

    Handler handler;


    public HandlerExecutionChain(Handler handler) {
        this.handler = handler;
    }



    public ModelAndView handler() throws InvocationTargetException, IllegalAccessException {
        Method method=handler.getMethod();
        Object object = handler.getController();

        Object viewName=method.invoke(object,null);
        ModelAndView modelAndView=new ModelAndView((String) viewName);
        return modelAndView;


    }


}
